#ifndef ARCH_PORTIO_H_
#define ARCH_PORTIO_H_

/*
	Copyright (C) 2014 Salil Bhagurkar

	This file is part of illusion

	illusion is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	illusion is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with illusion.  If not, see <http://www.gnu.org/licenses/>.
*/


/*
 * Port IO functions for use by drivers
 */

#define inb(port) \
({ unsigned char _tmp__; \
	__asm__ volatile("inb %%dx, %0" : "=a" (_tmp__) : "d" ((unsigned short)(port))); \
	_tmp__; })

#define outb(port, val) \
({ __asm__ volatile("outb %0, %%dx" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); })



#endif /* ARCH_PORTIO_H_ */
